package com.gitee.magic.core.converter;

/**
 * @author start
 */
public abstract class AbstractConverterEditor<T> implements Converter<T> {
	
	public AbstractConverterEditor(Class<?> prototype) {
		this.prototype=prototype;
	}
	
	private Object value;
	
	private Class<?> prototype;
	
	private Object source;
	
	public Object getValue() {
		return value;
	}

	public void setValue(Object value) {
		this.value = value;
	}

	/**
	 * 用于json输出如果value类型不为String应考虑重写该方法
	 * @return
	 */
	public Object getSource() {
		if(source==null) {
			return getValue();
		}
		return source;
	}

	public void setSource(Object source) {
		this.source = source;
	}

	public Class<?> getPrototype() {
		return prototype;
	}

	public void setPrototype(Class<?> prototype) {
		this.prototype = prototype;
	}
	
}
